package com.wj.ch2.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * @program: wj_springBoot
 * @description: 发布事件
 * @author: wj
 * @create: 2021-10-21 15:23
 **/
@Component
public class DemoPublisher {

    @Autowired
    private ApplicationContext context;

    public void publish(String msg){
        context.publishEvent(new DemoEvent(this,msg));
    }

}
